package chapter6.e7;

import java.util.HashSet;
import java.util.Iterator;

public class e7 {
    public static void main(String[] args) {
        HashSet set = new HashSet();
        set.add("张三");
        set.add("李四");
        set.add("王五");
        set.add("李四");//加个相同对象
        System.out.println(set);
        Iterator iterator = set.iterator();//返回迭代器
        while (iterator.hasNext());
             Object o = iterator.next();
             System.out.println(o);
    }
}
